<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <video src=""></video>
</body>
<script>
    var constraints = { audio: true, video: { width: 1280, height: 720 } };
    var promise = navigator.mediaDevices.getUserMedia(constraints);
    var video = document.querySelector('video');
    promise.then(mediaStream => {
        console.log('mediaStream', mediaStream)

        video.srcObject = mediaStream;
        video.onloadedmetadata = function (e) {
            video.play();
        };
    }).catch(err => {
        console.log('err', err)
        console.log(err.name + ": " + err.message)
    })
</script>

</html>